package com.oamic.sdk.picker.pickerview.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 * create by wangyq on 2018/11/26
 */
public class DateUtil {
    static SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd");
    
    /**
     * 根据时间获取星期
     *
     * @param calendar
     * @return
     */
    public static String getWeek(Calendar calendar) {
        int week = calendar.get(Calendar.DAY_OF_WEEK);
        return weekToStrCN(week);
    }
    
    public static String weekToStrCN(int week) {
        switch (week) {
            case 1:
                return "周日";
            case 2:
                return "周一";
            case 3:
                return "周二";
            case 4:
                return "周三";
            case 5:
                return "周四";
            case 6:
                return "周五";
            case 7:
                return "周六";
        }
        return "";
    }
}
